package cn.hanyx.coder.design.pattern.structural.bridge.info;

import cn.hanyx.coder.design.pattern.structural.bridge.info.NotificationEmergencyLevel;

import java.util.List;

/**
 * 告警通知类，支持邮件、短信、微信、手机等多种通知渠道
 */
public class Notification {
    private List<String> emailAddresses;
    private List<String> telephones;
    private List<String> wechatIds;

    public void setEmailAddress(List emailAddress) {
        this.emailAddresses = emailAddress;
    }

    public void setTelephones(List telephones) {
        this.telephones = telephones;
    }

    public void setWechatIds(List wechatIds) {
        this.wechatIds = wechatIds;
    }

    /**
     * 发送通知
     *
     * @param level
     * @param message
     */
    public void notify(NotificationEmergencyLevel level, String message) {
        if (level.equals(NotificationEmergencyLevel.SEVERE)) {
            System.out.println("SEVERE: 自动语音电话");
        } else if (level.equals(NotificationEmergencyLevel.URGENCY)) {
            System.out.println("URGENCY: 发微信");
        } else if (level.equals(NotificationEmergencyLevel.NORMAL)) {
            System.out.println("NORMAL: 发邮件");
        } else if (level.equals(NotificationEmergencyLevel.TRIVIAL)) {
            System.out.println("TRIVIAL: 发邮件");
        }
    }
}